package com.cg.mapper;

import com.cg.entity.DictPositionKeyword;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 岗位关键词字典Mapper接口
 */
@Mapper
public interface DictPositionKeywordMapper {
    
    /**
     * 根据关键词名称查询
     * @param name 关键词名称
     * @return 关键词信息
     */
    @Select("SELECT * FROM dict_position_keyword WHERE name = #{name}")
    DictPositionKeyword getByName(String name);
    
    /**
     * 查询所有关键词
     * @return 关键词列表
     */
    @Select("SELECT * FROM dict_position_keyword ORDER BY id")
    List<DictPositionKeyword> getAll();
    
    /**
     * 插入关键词
     * @param keyword 关键词信息
     */
    @Insert("INSERT INTO dict_position_keyword (name) VALUES (#{name})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    void insert(DictPositionKeyword keyword);
}
